<template>
	
	<view class="wrap">
		<u-form class="form" :model="model" :rules="rules" ref="uForm" label-position="left">
			<view style="position: relative;">
			<div class="tableTitle"><span class="midText">任务信息</span></div>
			<u-form-item label="任务类型" label-width="180">
					<u-input type="text" placeholder="无" v-model="model.taskTypeName" height="100" disabled />
			</u-form-item>
			<u-form-item label="任务标题" label-width="180">
					<u-input type="textarea" placeholder="无" v-model="model.taskTitle" height="100" disabled />
			</u-form-item>
			<u-form-item label="任务内容" label-width="180">
					<u-input type="textarea" placeholder="无" v-model="model.taskContent" height="100" disabled />
			</u-form-item>
			<u-form-item label="联系人" label-width="180"><u-input v-model="model.contactName" disabled type="text"></u-input></u-form-item>
			<u-form-item label="联系电话" label-width="180"><u-input v-model="model.contactPhone" disabled type="text"></u-input></u-form-item>
			<div class="tableTitle"><span class="midText">任务整理信息</span></div>
			<u-form-item label="最新进展" label-width="180">
					<u-input type="textarea" placeholder="无" v-model="model.arrangeContent" height="100" disabled />
			</u-form-item>
			<u-form-item label="存在问题" label-width="180">
					<u-input type="textarea" placeholder="无" v-model="model.arrangeContent2" height="100" disabled />
			</u-form-item>
			<u-form-item label="拟采取的工作举措" label-width="180">
					<u-input type="textarea" placeholder="无" v-model="model.arrangeContent3" height="100" disabled />
			</u-form-item>
			<u-form-item label="任务状态" label-width="180">
					<u-input type="textarea" placeholder="无" v-model="model.taskArrangeStatus" height="100" disabled />
			</u-form-item>
			
			</view>
			<!-- 附件 -->
				<view class="lh-mt-36">
					<LhFilelist v-if="model.id" :bizKey="model.id" bizType="dcSupTaskInfo_file" />
				</view>
		</u-form>
		
		<u-form class="form" :model="model1" :rules="rules" ref="uForm1" label-position="left">
			<u-modal v-model="show" :title="title" @cancel="cancel" @confirm="confirm1" confirmText="确定" cancelText="取消" :show-cancel-button="true">
				<view class="u-update-content" style="margin-top: 20rpx">
					<textarea
						type="text"
						style="
				      width: 90%;
				      margin: auto;
				      height: 200rpx;
				      border: 1px solid #ccc;
				      font-size: 14px;
				    "
						v-model="model1.auditOption"
						placeholder-class="line"
						maxlength="100"
						placeholder="文字限制在100字以内"
					/>
				</view>
			</u-modal>
		</u-form>
		
		<view class="form-footer" v-if="model.auditStatus == 1">
			<u-button class="btn" type="primary" @click="show2">通过</u-button>
			<u-button class="btn" type="error" @click="show1">驳回</u-button>
		</view>
	</view>
</template>
<script>
/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
import LhFilelist from '@/components/lh-filelist/lh-filelist.vue';
export default {
	components: {
		LhFilelist
	},
	data() {
		return {
			title:'审核意见',
			show:false,
			model1: {
				auditResult: '',
				auditOption: '',
				id: '',
				targetType: '',
				targetId: '',
				dcSupTaskInfo: { id: '', createBy: '' }
			},
			rules: {
					
			},
			model: {
				normalFlag:'',
				id: '',
				taskYear: new Date().getFullYear(),
				taskTypeCode: '',
				taskTypeName: '',
				taskTitle: '',
				taskContent: '',
				targetType: '',
				targetId: '',
				taskId: '',
				auditorCode: '',
				feedbackWay: 4,
				auditorName: '',
				taskStatus: '2',
				contactName: '',
				contactPhone: '',
				formFlag: '0',
				auditFlag: '0',
				attachmentFlag: '0',
				msgNum: '督一〔2022〕',
				msgNum2: '',
				messageNumber: '',
				remarks2: 'app',
				normalFlag: 1,
				dcSupTaskInfo_file:'',
				dcSupTaskInfo_file__del:''
			},
		};
	},
	onLoad(params) {
			uni.setNavigationBarTitle({
				title: '任务整理审核详情'
			});

			this.$u.api.auditArrange.form({ id: params.id }).then(res => {
				let that = this;
				// 回显
				that.model.id = res.data.id;
				that.model.taskYear = res.data.taskYear;
				that.model.taskTypeCode = res.data.taskTypeCode;
				that.model.taskTypeName = res.data.taskTypeName;
				that.model.taskTitle = res.data.taskTitle;
				that.model.taskContent = res.data.taskContent;
				that.model.taskStartTime = res.data.taskStartTime;
				that.model.taskEndTime = res.data.taskEndTime;
				that.model.contactName = res.data.contactName;
				that.model.contactPhone = res.data.contactPhone;
				that.model.targetType = res.data.targetType;
				that.model.targetId = res.data.targetId;
				that.model.taskId = res.data.taskId;
				that.model.taskLeaderName = res.data.taskLeaderName;
				that.model.taskLeaderOrgName = res.data.taskLeaderOrgName;
				that.model.auditorCode = res.data.auditorCode;
				that.model.auditorName = res.data.auditorName;
				that.model.msgNum = res.data.msgNum;
				that.model.msgNum2 = res.data.msgNum2;
				that.model.messageNumber = res.data.messageNumber;
				that.model.formFlag = res.data.formFlag;
				that.model.auditFlag = res.data.auditFlag;
				that.model.auditStatus = res.data.auditStatus;
				that.model.auditType = res.data.auditType;
				that.model.createBy = res.data.createBy;
				that.model.taskLeaderOrg = res.data.taskLeaderOrg;
				
				that.model.arrangeContent = res.data.arrangeContent;
				that.model.arrangeContent2 = res.data.arrangeContent2;
				that.model.arrangeContent3 = res.data.arrangeContent3;
				if(res.data.taskArrangeStatus==1){
					that.model.taskArrangeStatus = '已完成';
				}else if(res.data.taskArrangeStatus==2){
					that.model.taskArrangeStatus = '序时推进';
				}else if(res.data.taskArrangeStatus==3){
					that.model.taskArrangeStatus = '副秘书长调度';
				}else if(res.data.taskArrangeStatus==4){
					that.model.taskArrangeStatus = '副市长调度';
				}
				
			});
	},
	onReady() {
	},
	methods: {
		confirm1() {
			this.model1.auditResult = 2;
			this.model1.targetType = this.model.targetType;
			this.model1.auditType = this.model.auditType;
			this.model1.id = this.model.id;
			this.model1.taskId = this.model.taskId;
			this.model1.targetId = this.model.targetId;
			this.model1.dcSupTaskInfo.id = this.model.taskId;
			this.model1.dcSupTaskInfo.createBy = this.model.createBy;
			this.$u.api.auditArrange.save(this.model1).then(res => {
				if (res.result == 'true') {
					uni.showModal({
						title: '提示',
						content: res.message,
						showCancel: false,
						success: function() {
							if (res.result == 'true') {
								uni.setStorageSync('refreshList', true);
								uni.navigateBack();
							}
						}
					});
				}
			});
		},
		show1() {
					this.show = true;
					this.$refs.uForm1.setRules(this.rules);
				},
		cancel() {},
		show2() {
			this.model1.auditResult = 1;
			this.model1.targetType = this.model.targetType;
			this.model1.id = this.model.id;
			this.model1.taskId = this.model.taskId;
			this.model1.targetId = this.model.targetId;
			this.model1.auditType = this.model.auditType;
			this.model1.dcSupTaskInfo.id = this.model.taskId;
			this.model1.dcSupTaskInfo.createBy = this.model.createBy;
			this.$u.api.auditArrange.save(this.model1).then(res => {
				if (res.result == 'true') {
					uni.showModal({
						title: '提示',
						content: '审核成功',
						icon: 'success',
						showCancel: false,
						buttonText: '我知道了',
						success: function(res) {
							if (res.confirm) {
								uni.setStorageSync('refreshList', true);
								uni.navigateBack();
							} else {
							}
						}
					});
				}
			});
		},
	}
};
</script>
<style lang="scss">
.u-model__title {
	color: #ff0000 !important;
}
.tableTitle {
    color: royalblue;
  }
.midText {
    left: 10%;
	font-style: italic;
    transform: translateX(-50%) translateY(-50%);
  }
</style>
